package com.zzyl.member.service.serviceImpl;

import java.util.List;
import com.zzyl.common.utils.DateUtils;
import com.zzyl.member.domin.Reservation;
import com.zzyl.member.dto.ReservationDto;
import com.zzyl.member.mapper.ReservationMapper;
import com.zzyl.member.service.IReservationService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;

/**
 * 预约信息Service业务层处理
 * 
 * @author CHEN
 * @date 2025-07-31
 */
@Service
public class ReservationServiceImpl extends ServiceImpl<ReservationMapper, Reservation> implements IReservationService
{

    @Autowired
    private ReservationMapper reservationMapper;


    /**
     * 查询预约信息列表
     *
     * @param reservation 预约信息
     * @return 预约信息
     */
    @Override
    public List<Reservation> selectReservationList(Reservation reservation)
    {
        return reservationMapper.selectReservationList(reservation);
    }


    /**
     * 查询当天取消预约数量
     * @return
     */
    @Override
    public String getCancelledCount() {
        return reservationMapper.getCancelledCount();
    }


    /**
     * 新增预约
     * @param reservationDto
     * @return
     */
    @Override
    public void insertReservation(ReservationDto reservationDto) {
        Reservation reservation = new Reservation();
        BeanUtils.copyProperties(reservationDto, reservation);
        reservation.setStatus(0);
        reservationMapper.insert(reservation);
    }

    /**
     * 查询每个时间段剩余预约次数（每个时间段最多六次）
     * @return
     */
//    @Override
//    public String getTimingCount(Long time) {
//        return reservationMapper.getTimingCount(time);
//    }


}
